import { request } from '@/utils/request.js'

/**
 * 运单 API JS
 */

export default {
  printInbound: () => {
    return request({
        // todo 后端
        url: 'document/shipment/printInbound',
        method: 'get',
        responseType: 'blob'
    })
  },

  /**
   * 获取运单分页列表
   * @returns
   */
  getList (data = {}) {
    return request({
      url: 'document/shipment/index',
      method: 'post',
      data
    })
  },
  /**
   * 获取运单列表
   * @returns
   */
  getAllList (params = {}) {
    return request({
      url: 'document/shipment/list',
      method: 'get',
      params
    })
  },

  /**
   * 添加运单
   * @returns
   */
  save (data = {}) {
    return request({
      url: 'document/shipment/save',
      method: 'post',
      data
    })
  },

  /**
   * 更新运单数据
   * @returns
   */
  update (data = {}) {
    return request({
      url: 'document/shipment/update/' + data.id,
      method: 'put',
      data
    })
  },
  /**
   * 更新用户
   * @returns
   */
  updateCustomer (data = {}) {
    return request({
      url: 'document/shipment/customer',
      method: 'put',
      data
    })
  },

  /**
   * 批量更新运单数据
   * @returns
   */
  updateBatch (data = {}) {
    return request({
      url: 'document/shipment/updateBatch',
      method: 'put',
      data
    })
  },

  /**
   * 预配货
   * @returns
   */
  updateWeightVolume (data = {}) {
    return request({
      url: 'document/shipment/updateWeightVolume',
      method: 'put',
      data
    })
  },
  /**
   * 末端派送
   * @returns
   */
  endDeliveryType (data = {}) {
    return request({
      url: 'document/shipment/endDeliveryType',
      method: 'put',
      data
    })
  },
  /**
   * 固定收费重
   * @returns
   */
  updateCharge (data = {}) {
    return request({
      url: 'document/shipment/updateCharge',
      method: 'put',
      data
    })
  },
  /**
   * 供应商信息
   * @returns
   */
  updateSupplierInfo (data = {}) {
    return request({
      url: 'document/shipment/updateSupplierInfo',
      method: 'put',
      data
    })
  },
  
  /**
   * 读取运单
   * @returns
   */
  read (id) {
    return request({
      url: 'document/shipment/read/' + id,
      method: 'get',
    })
  },

  /**
   * 将运单删除，有软删除则移动到回收站
   * @returns
   */
  deletes (data) {
    return request({
      url: 'document/shipment/delete',
      method: 'delete',
      data
    })
  },

  /**
   * 从回收站获取运单数据列表
   * @returns
   */
  getRecycleList (params = {}) {
    return request({
      url: 'document/shipment/recycle',
      method: 'get',
      params
    })
  },

  /**
   * 恢复运单数据
   * @returns
   */
  recoverys (data) {
    return request({
      url: 'document/shipment/recovery',
      method: 'put',
      data
    })
  },

  /**
   * 真实删除运单
   * @returns
   */
  realDeletes (data) {
    return request({
      url: 'document/shipment/realDelete',
      method: 'delete',
      data
    })
  },

  /**
   * 更改运单数据
   * @returns
   */
  changeStatus (data = {}) {
    return request({
      url: 'document/shipment/changeStatus',
      method: 'put',
      data
    })
  },

  /**
   * 重新发货
   * */
  resend (data = {}) {
    return request({
      url: 'document/shipment/resend',
      method: 'put',
      data
    })
  },

  /**
   * 取消
   * */
  cancel (data = {}) {
    return request({
      url: 'document/shipment/cancel',
      method: 'put',
      data
    })
  },

  /**
   * 转运
   */
  transhipment (data = {}) {
    return request({
      url: 'document/shipment/transhipment',
      method: 'put',
      data
    })
  },

  /**
   * 退件
   */
  back (data = {}) {
    return request({
      url: 'document/shipment/back',
      method: 'put',
      data
    })
  },

  /**
   * 已签收
   */
  sign (data = {}) {
    return request({
      url: 'document/shipment/sign',
      method: 'put',
      data
    })
  },

  /**
    * 运单导入
    * @returns
    */
  importExcel (data = {}) {
    return request({
      url: 'document/shipment/import',
      method: 'post',
      data
    })
  },
  /**
    * 导入附件
    * @returns
    */
  execlFile (data = {}) {
    return request({
      url: 'document/shipment/execlFile',
      method: 'post',
      data
    })
  },

  /**
   * 按客户数据拣货
   * @returns
   */
  pickByClient (data) {
    return request({
      url: 'document/shipment/pickByClient',
      method: 'post',
      data
    })
  },
  /**
   * 审计
   * @returns
   */
  auditPass (data) {
    return request({
      url: 'document/shipment/audit/pass',
      method: 'post',
      data
    })
  },
  /**
   * 反审计
   * @returns
   */
  auditRefuse (data) {
    return request({
      url: 'document/shipment/audit/refuse',
      method: 'post',
      data
    })
  },
  /**
   * 审计
   * @returns
   */
  auditPassForWaybill (data) {
    return request({
      url: 'document/waybill/audit/pass',
      method: 'post',
      data
    })
  },
  /**
   * 反审计
   * @returns
   */
  auditRefuseForWaybill (data) {
    return request({
      url: 'document/waybill/audit/refuse',
      method: 'post',
      data
    })
  },
  /**
   * 审计
   * @returns
   */
  auditPassForDelivery (data) {
    return request({
      url: 'warehouse/delivery/audit/pass',
      method: 'post',
      data
    })
  },
  /**
   * 反审计
   * @returns
   */
  auditRefuseForDelivery (data) {
    return request({
      url: 'warehouse/delivery/audit/refuse',
      method: 'post',
      data
    })
  },
  /**
   * 下载模板
   * @returns
   */
  downloadTemplate (params={}) {
    return request({
      url: 'document/shipment/downloadTemplate',
      method: 'get',
      params
    })
  },
  /**
   * 费用重算
   * @returns
   */
  recalculation (data={}) {
    return request({
      url: 'document/shipment/recalculation',
      method: 'post',
      data
    })
  },
  /**
   * 合并运单
   * @returns
   */
  merge (data={}) {
    return request({
      url: 'document/shipment/merge',
      method: 'post',
      data
    })
  },
  /**
   * 取消合并运单
   * @returns
   */
  split (data={}) {
    return request({
      url: 'document/shipment/split',
      method: 'post',
      data
    })
  },
  /**
   * 搜索合并
   * @returns
   */
  searchMerge (data={}) {
    return request({
      url: 'document/shipment/searchMerge',
      method: 'post',
      data
    })
  },
  /**
   * 搜索拆分
   * @returns
   */
  searchSplit (data={}) {
    return request({
      url: 'document/shipment/searchSplit',
      method: 'post',
      data
    })
  },
  /**
   * 同步
   * @returns
   */
  synchronous (data={}) {
    return request({
      url: 'document/shipment/synchronous',
      method: 'post',
      data
    })
  },
  thirdOrder (data={}) {
    return request({
      url: 'document/shipment/thirdOrder',
      method: 'post',
      data
    })
  },
  getThirdOrderForm (data={}) {
    return request({
      url: 'document/shipment/getThirdOrderForm',
      method: 'post',
      data
    })
  },
  thirdOrderPick (data={}) {
    return request({
      url: 'document/shipment/thirdOrderPick',
      method: 'post',
      data
    })
  },
  thirdOrderRoute (data={}) {
    return request({
      url: 'document/shipment/thirdOrderRoute',
      method: 'post',
      data
    })
  },
  getTrackingNumbers (data={}) {
    return request({
      url: 'document/shipment/getTrackingNumbers',
      method: 'post',
      data
    })
  },
  changeService (data={}) {
    return request({
      url: 'document/shipment/changeService',
      method: 'post',
      data
    })
  },
  changeRoute (data={}) {
    return request({
      url: 'document/shipment/changeRoute',
      method: 'post',
      data
    })
  },
    //统计
    listTotal (data={}) {
      return request({
        url: 'document/shipment/listTotal',
        method: 'post',
        data
      })
    },
}